#!/bin/bash

APP=edu
# 如果是输入的日期按照取输入日期；如果没输入日期取当前时间的前一天
if [ -n "$2" ] ;then
    do_date=$2
else 
    do_date=`date -d "-1 day" +%F`
fi

ads_traffic_stats_by_source_type="
insert overwrite table ${APP}.ads_traffic_stats_by_source_type
select * from ${APP}.ads_traffic_stats_by_source_type
union
select
    '$do_date' dt,
    recent_days,
    source_type,
    cast(count(distinct(mid_id)) as bigint) uv_count,
    cast(avg(during_time_1d)/1000 as bigint) avg_duration_sec,
    cast(avg(page_count_1d) as bigint) avg_page_count,
    cast(count(*) as bigint) sv_count,
    cast(sum(if(page_count_1d=1,1,0))/count(*) as decimal(16,2)) bounce_rate
from ${APP}.dws_traffic_session_page_view_1d lateral view explode(array(1,7,30)) tmp as recent_days
where dt>=date_add('$do_date',-recent_days+1)
group by recent_days,source_type;
"
ads_page_path="
insert overwrite table ${APP}.ads_page_path
select * from ${APP}.ads_page_path
union
select
    '$do_date' dt,
    source,
    nvl(target,'null'),
    count(*) path_count
from
(
    select
        concat('step-',rn,':',page_id) source,
        concat('step-',rn+1,':',next_page_id) target
    from
    (
        select
            page_id,
            lead(page_id,1,null) over(partition by session_id order by view_time) next_page_id,
            row_number() over (partition by session_id order by view_time) rn
        from ${APP}.dwd_traffic_page_view_inc
        where dt='$do_date'
    )t1
)t2
group by source,target;
"
ads_study_play_video_by_chapter="
insert overwrite table ${APP}.ads_study_play_video_by_chapter
select * from ${APP}.ads_study_play_video_by_chapter
union
select
   '$do_date' dt,
   recent_days,
   course_id,
   course_name,
   chapter_id,
   chapter_name,
   video_id,
   video_name,
   video_count,
   video_avg,
   user_count
from
(
select
        1 recent_days,
        course_id,
        course_name,
        chapter_id,
        chapter_name,
        video_id,
        video_name,
        sum(video_count_1d) video_count,        
        avg(video_avg_1d) video_avg,
        sum(user_count_1d) user_count
from ${APP}.dws_study_chapter_process_1d
where dt='$do_date'
group by  course_id,course_name,chapter_id,chapter_name,video_id,video_name
union all
        select
            recent_days,
            course_id,
            course_name,
            chapter_id,
            chapter_name,
            video_id,
            video_name,
            sum(video_count) video_count,        
            avg(video_avg) video_avg,
            sum(user_count) user_count
         from
    (
        select
            recent_days,
            course_id,
            course_name,
            chapter_id,
            chapter_name,
            video_id,
            video_name,
            case recent_days
                when 7 then video_count_7d
                when 30 then video_count_30d
            end video_count,
            case recent_days
                when 7 then video_avg_7d
                when 30 then video_avg_30d
            end video_avg,
            case recent_days
                when 7 then user_count_7d
                when 30 then user_count_30d
            end user_count
        from ${APP}.dws_study_chapter_process_nd lateral view explode(array(7,30)) tmp as recent_days
        where dt='$do_date'
    )t1
    group by course_id,course_name,chapter_id,chapter_name,video_id,video_name,recent_days
)odr;
"
ads_study_play_video_by_course="
insert overwrite table ${APP}.ads_study_play_video_by_course
select * from ${APP}.ads_study_play_video_by_course
union
select
   '$do_date' dt,
   recent_days,
   course_id,
   course_name,
   video_count,
   video_avg,
   user_count
from
(
select
        1 recent_days,
        course_id,
        course_name,
        sum(video_count_1d) video_count,        
        avg(video_avg_1d) video_avg,
        sum(user_count_1d) user_count
from ${APP}.dws_study_course_process_1d
where dt='$do_date'
group by  course_id,course_name
union all
        select
            recent_days,
            course_id,
            course_name,
            sum(video_count) video_count,        
            avg(video_avg) video_avg,
            sum(user_count) user_count
         from
    (
        select
            recent_days,
            course_id,
            course_name,
            case recent_days
                when 7 then video_count_7d
                when 30 then video_count_30d
            end video_count,
            case recent_days
                when 7 then video_avg_7d
                when 30 then video_avg_30d
            end video_avg,
            case recent_days
                when 7 then user_count_7d
                when 30 then user_count_30d
            end user_count
        from ${APP}.dws_study_course_process_nd lateral view explode(array(7,30)) tmp as recent_days
        where dt='$do_date'
    )t1
    group by course_id,course_name,recent_days
)odr;
"
ads_traffic_order_by_sc="
insert overwrite table ${APP}.ads_traffic_order_by_sc
     select * from ${APP}.ads_traffic_order_by_sc
     union
        select
            '$do_date' dt,
            1  recent_days,
            sc,
            source_site,
            cast( user_count_1d AS BIGINT) user_count,
            cast( order_count_1d AS BIGINT)order_count,
            cast( total_amount_1d  AS DECIMAL(16,2)) sum_total_amount,
            cast( (order_count_1d/user_count_1d) AS DECIMAL(16,2)) convert_rate
         from ${APP}.dws_traffic_source_order_payment_1d
         where dt = '$do_date'
        union all
         select
             '$do_date' dt,
             recent_days,
             sc,
             source_site,
             cast( max(`if`(recent_days = 7 ,user_count_7d, user_count_30d) ) AS BIGINT) user_count,
             cast( max(`if`(recent_days = 7 ,order_count_7d, order_count_30d) ) AS BIGINT) order_count,
             cast( min(`if`(recent_days = 7 ,total_amount_7d,total_amount_30d)) AS DECIMAL(16,2)) sum_total_amount,
             cast( min(`if`(recent_days = 7 ,(order_count_7d/user_count_7d),(order_count_30d/user_count_30d)))AS DECIMAL(16,2)) convert_rate
         from ${APP}.dws_traffic_source_order_payment_nd lateral view explode(`array`(7, 30)) tmp as recent_days
         where dt = '$do_date'
        group by recent_days, sc,source_site;
"
ads_audition_category_by_tm="
insert overwrite table ${APP}.ads_audition_category_by_tm
select * from ${APP}.ads_audition_category_by_tm
union
select
       '$do_date' dt,
       recent_days,
       category_id,
       category_name,
       audition_user_num,
       audition_rate
from (
         select 1                                              recent_days,
                category_id,
                category_name,
                sum(user_count_1d)                             audition_user_num,
                sum(audition_user_sum_1d) / sum(user_count_1d) audition_rate
         from ${APP}.dws_video_audition_play_1d
         where dt = '$do_date'
         group by category_id, category_name
         union all
         select 7                                              recent_days,
                category_id,
                category_name,
                sum(user_count_7d)                             audition_user_num,
                sum(audition_user_sum_7d) / sum(user_count_7d) audition_rate
         from ${APP}.dws_video_audition_play_nd
         where dt = '$do_date'
         group by category_id, category_name
     ) t1 order by recent_days;
"
ads_audition_subject_by_tm="
insert overwrite table ${APP}.ads_audition_subject_by_tm
select * from ${APP}.ads_audition_subject_by_tm
union
select
       '$do_date' dt,
       recent_days,
       subject_id subject_id,
       subject_name subject_name,
       audition_user_num,
       audition_rate
from (
         select 1                                              recent_days,
                subject_id subject_id,
                subject_name subject_name,
                sum(user_count_1d)                             audition_user_num,
                sum(audition_user_sum_1d) / sum(user_count_1d) audition_rate
         from ${APP}.dws_video_audition_play_1d
         where dt = '$do_date'
         group by subject_id, subject_name
         union all
         select 7                                              recent_days,
                subject_id subject_id,
                subject_name subject_name,
                sum(user_count_7d)                             audition_user_num,
                sum(audition_user_sum_7d) / sum(user_count_7d) audition_rate
         from ${APP}.dws_video_audition_play_nd
         where dt = '$do_date'
         group by subject_id, subject_name
     ) t1;
"
ads_audition_course_by_tm="
insert overwrite table ${APP}.ads_audition_course_by_tm
select * from ${APP}.ads_audition_course_by_tm
union
select
       '$do_date' dt,
       recent_days,
       course_id course_id,
       course_name course_name,
       audition_user_num,
       audition_rate
from (
         select 1                                              recent_days,
                course_id course_id,
                course_name course_name,
                sum(user_count_1d)                             audition_user_num,
                sum(audition_user_sum_1d) / sum(user_count_1d) audition_rate
         from ${APP}.dws_video_audition_play_1d
         where dt = '$do_date'
         group by course_id, course_name
         union all
         select 7                                              recent_days,
                course_id course_id,
                course_name course_name,
                sum(user_count_7d)                             audition_user_num,
                sum(audition_user_sum_7d) / sum(user_count_7d) audition_rate
         from ${APP}.dws_video_audition_play_nd
         where dt = '$do_date'
         group by course_id, course_name
     ) t1
order by course_id,recent_days;
"
ads_new_order_user_stats="
insert overwrite table ${APP}.ads_new_order_user_stats
select *
from ${APP}.ads_new_order_user_stats
union
select '$do_date'                                                                dt,
       recent_days,
       sum(if(order_date_first >= date_add('2021-04-25', -recent_days + 1), 1, 0)) new_order_user_count
from ${APP}.dws_trade_user_order_td lateral view explode(array(1, 7, 30)) tmp as recent_days
where dt = '$do_date'
group by recent_days;
"
ads_new_pay_user_stats="
insert overwrite table ${APP}.ads_new_pay_user_stats
select *
from ${APP}.ads_new_pay_user_stats
union
select '$do_date'                                                                dt,
       recent_days,
       sum(if(pay_date_first >= date_add('2021-04-25', -recent_days + 1), 1, 0)) new_pay_user_count
from ${APP}.dws_trade_user_pay_td lateral view explode(array(1, 7, 30)) tmp as recent_days
where dt = '$do_date'
group by recent_days;
"
ads_order_stats_by_cate="
insert overwrite table ${APP}.ads_order_stats_by_cate
select *
from ${APP}.ads_order_stats_by_cate
union
select '$do_date' dt,
       recent_days,
       category_id,
       category_name,
       order_count,
       order_user_count,
       order_total_amount
from (select 1                          recent_days,
             category_id,
             category_name,
             sum(order_count_1d)        order_count,
             count(distinct (user_id))  order_user_count,
             sum(order_total_amount_1d) order_total_amount
      from ${APP}.dws_trade_user_course_order_1d
      where dt = '$do_date'
      group by category_id, category_name
      union all
      select recent_days,
             category_id,
             category_name,
             sum(order_count),
             count(distinct (if(order_count > 0, user_id, null))),
             sum(order_total_amount)
      from (select recent_days,
                   user_id,
                   category_id,
                   category_name,
                   case recent_days
                       when 7 then order_count_7d
                       when 30 then order_count_30d
                       end order_count,
                   case recent_days
                       when 7 then order_total_amount_7d
                       when 30 then order_total_amount_30d
                       end order_total_amount
            from ${APP}.dws_trade_user_course_order_nd lateral view explode(array(7, 30)) tmp as recent_days
            where dt = '$do_date') t1
      group by recent_days, category_id, category_name) odr;
"
ads_order_stats_by_subject="
insert overwrite table ${APP}.ads_order_stats_by_subject
select *
from ${APP}.ads_order_stats_by_subject
union
select '$do_date' dt,
       recent_days,
       subject_id,
       subject_name,
       order_count,
       order_user_count,
       order_total_amount
from (select 1                          recent_days,
             subject_id,
             subject_name,
             sum(order_count_1d)        order_count,
             count(distinct (user_id))  order_user_count,
             sum(order_total_amount_1d) order_total_amount
      from ${APP}.dws_trade_user_course_order_1d
      where dt = '$do_date'
      group by subject_id, subject_name
      union all
      select recent_days,
             subject_id,
             subject_name,
             sum(order_count),
             count(distinct (if(order_count > 0, user_id, null))),
             sum(order_total_amount)
      from (select recent_days,
                   user_id,
                   subject_id,
                   subject_name,
                   case recent_days
                       when 7 then order_count_7d
                       when 30 then order_count_30d
                       end order_count,
                   case recent_days
                       when 7 then order_total_amount_7d
                       when 30 then order_total_amount_30d
                       end order_total_amount
            from ${APP}.dws_trade_user_course_order_nd lateral view explode(array(7, 30)) tmp as recent_days
            where dt = '$do_date') t1
      group by recent_days, subject_id, subject_name) odr;
"
ads_order_stats_by_course="
insert overwrite table ${APP}.ads_order_stats_by_course
select *
from ${APP}.ads_order_stats_by_cate
union
select '$do_date' dt,
       recent_days,
       course_id,
       course_name,
       order_count,
       order_user_count,
       order_total_amount
from (select 1                          recent_days,
             course_id,
             course_name,
             sum(order_count_1d)        order_count,
             count(distinct (user_id))  order_user_count,
             sum(order_total_amount_1d) order_total_amount
      from ${APP}.dws_trade_user_course_order_1d
      where dt = '$do_date'
      group by course_id, course_name
      union all
      select recent_days,
             course_id,
             course_name,
             sum(order_count),
             count(distinct (if(order_count > 0, user_id, null))),
             sum(order_total_amount)
      from (select recent_days,
                   user_id,
                   course_id,
                   course_name,
                   case recent_days
                       when 7 then order_count_7d
                       when 30 then order_count_30d
                       end order_count,
                   case recent_days
                       when 7 then order_total_amount_7d
                       when 30 then order_total_amount_30d
                       end order_total_amount
            from ${APP}.dws_trade_user_course_order_nd lateral view explode(array(7, 30)) tmp as recent_days
            where dt = '$do_date') t1
      group by recent_days, course_id, course_name) odr;
"
ads_order_stats_by_course_all="
insert overwrite table ${APP}.ads_order_stats_by_course_all
select *
from ${APP}.ads_order_stats_by_cate
union
select '$do_date' dt,
       recent_days,
       order_count,
       order_user_count,
       order_total_amount
from (select 1                          recent_days,
             sum(order_count_1d)        order_count,
             count(distinct (user_id))  order_user_count,
             sum(order_total_amount_1d) order_total_amount
      from ${APP}.dws_trade_user_course_order_1d
      where dt = '$do_date'
      union all
      select recent_days,
             sum(order_count),
             count(distinct (if(order_count > 0, user_id, null))),
             sum(order_total_amount)
      from (select recent_days,
                   user_id,
                   case recent_days
                       when 7 then order_count_7d
                       when 30 then order_count_30d
                       end order_count,
                   case recent_days
                       when 7 then order_total_amount_7d
                       when 30 then order_total_amount_30d
                       end order_total_amount
            from ${APP}.dws_trade_user_course_order_nd lateral view explode(array(7, 30)) tmp as recent_days
            where dt = '$do_date') t1
      group by recent_days) odr;
"
ads_order_by_province="
insert overwrite table ${APP}.ads_order_by_province
select *
from ${APP}.ads_order_by_province
union
select '$do_date' dt,
       1            recent_days,
       province_id,
       province_name,
       area_code,
       iso_code,
       iso_3166_2,
       order_count_1d,
       order_total_amount_1d
from ${APP}.dws_trade_province_order_1d
where dt = '$do_date'
union
select '$do_date' dt,
       recent_days,
       province_id,
       province_name,
       area_code,
       iso_code,
       iso_3166_2,
       case recent_days
           when 7 then order_count_7d
           when 30 then order_count_30d
           end      order_count,
       case recent_days
           when 7 then order_total_amount_7d
           when 30 then order_total_amount_30d
           end      order_total_amount
from ${APP}.dws_trade_province_order_nd lateral view explode(array(7, 30)) tmp as recent_days
where dt = '$do_date';
"
ads_finishclass_chapter_finish_amount="
insert overwrite table ${APP}.ads_finishclass_chapter_finish_amount_1d  partition(dt)
select
user_id,
chapter_id,
chapter_name,
course_id,
course_name,
subject_id,
subject_name,
category_id,
count(distinct(user_id)) as finish_amount,
from ${APP}.dws_finishclass_user_chapter_finish_num_1d;
"
ads_user_change="
insert overwrite table ${APP}.ads_user_change
select * from ${APP}.ads_user_change
union
select
    churn.dt,
    user_churn_count, 
    user_back_count 
from
(
    select
        '$do_date' dt, 
        count(*) user_churn_count 
    from dws_user_user_login_td
    where dt='$do_date'
    and login_date_last=date_add('$do_date',-7)
)churn
join
(
    select
        '$do_date' dt,
        count(*) user_back_count
    from
    (
        select
            user_id,
            login_date_last
        from ${APP}.dws_user_user_login_td
        where dt='$do_date'
    )t1
    join
    (
        select
            user_id,
            login_date_last login_date_previous
        from ${APP}.dws_user_user_login_td
        where dt=date_add('$do_date',-1)
    )t2
    on t1.user_id=t2.user_id
    where datediff(login_date_last,login_date_previous)>=8 
)back
on churn.dt=back.dt;
"
ads_user_retention="
insert overwrite table ${APP}.ads_user_retention
select * from ${APP}.ads_user_retention
union
select
    '$do_date' dt,
    login_date_first create_date,
    datediff('$do_date',login_date_first) retention_day,
    sum(if(login_date_last='$do_date',1,0)) retention_count, 
    count(*) new_user_count,
    cast(sum(if(login_date_last='$do_date',1,0))/count(*)*100 as decimal(16,2)) retention_rate
from
(
    select
        user_id,
        date_id login_date_first
    from ${APP}.dwd_user_register_inc
    where dt>=date_add('$do_date',-7)
    and dt<'$do_date'
)t1
join
(
    select
        user_id,
        login_date_last
from ${APP}.dws_user_user_login_td
    where dt='$do_date'
)t2
on t1.user_id=t2.user_id
group by login_date_first;
"
ads_user_stats="
insert overwrite table ${APP}.ads_user_stats
select * from ${APP}.ads_user_stats
union
select
    '$do_date' dt,
    t1.recent_days,
    new_user_count,
    active_user_count
from
(
    select
        recent_days,
        sum(if(login_date_last>=date_add('$do_date',-recent_days+1),1,0)) active_user_count -- 活跃用户
    from ${APP}.dws_user_user_login_td lateral view explode(array(1,7,30)) tmp as recent_days
    where dt='2$do_date'
    group by recent_days
)t1
join
(
    select
        recent_days,
        sum(if(date_id>=date_add('$do_date',-recent_days+1),1,0)) new_user_count  -- 新增用户
    from ${APP}.dwd_user_register_inc lateral view explode(array(1,7,30)) tm\]p as recent_days
    group by recent_days
)t2
on t1.recent_days=t2.recent_days
order by recent_days;

"
ads_user_action="
insert overwrite table ${APP}.ads_user_action
select * from ${APP}.ads_user_action
union
select
    '$do_date' dt,
    page.recent_days,
    home_count,
    good_detail_count,
    cart_count,
    order_count,
    payment_count
from
(
    select
        recent_days,
        sum(if(page_id='home',1,0)) home_count,
        sum(if(page_id='good_detail',1,0)) good_detail_count
    from ${APP}.dws_traffic_page_visitor_page_view_1d lateral view explode(array(1,7,30)) tmp as recent_days
    where dt='$do_date'
    and page_id in ('home','good_detail')
    group by recent_days
)page
join
(
    select
        recent_days,
        count(*) cart_count
    from ${APP}.dws_trade_user_cart_add_1d lateral view explode(array(1,7,30)) tmp as recent_days
    where dt='$do_date'
    group by recent_days
)cart
on page.recent_days=cart.recent_days
join
(
    select
        recent_days,
        count(*) order_count
    from ${APP}.dws_trade_user_order_1d lateral view explode(array(1,7,30)) tmp as recent_days
    where dt='$do_date'
    group by recent_days
)ord
on page.recent_days=ord.recent_days
join
(
    select
        recent_days,
        count(*) payment_count
    from ${APP}.dws_trade_user_payment_1d lateral view explode(array(1,7,30)) tmp as recent_days
    where dt='2$do_date'
    group by recent_days
)pay
on page.recent_days=pay.recent_days
order by recent_days;
"
ads_new_order_user_stats="
insert overwrite table ${APP}.ads_new_order_user_stats
select * from ${APP}.ads_new_order_user_stats
union
select
    '$do_date' dt,
    order.recent_days,
    new_order_user_count,
    new_payment_user_count
from
(
    select
        
        recent_days,
        sum(if(order_date_first>=date_add('$do_date',-recent_days+1),1,0)) new_order_user_count
    from ${APP}.dws_trade_user_order_td lateral view explode(array(1,7,30)) tmp as recent_days
    where dt='$do_date'
    group by recent_days;
)order
jion
(
    select
        recent_days,
        sum(if(pay_date_first>=date_add('$do_date',-recent_days+1),1,0)) new_payment_user_count
    from ${APP}.dws_trade_user_payment_1d lateral view explode(array(1,7,30)) tmp as recent_days
    where dt='$do_date'
    group by recent_days
)pay
on order.recent_days=pay.recent_days
group by recent_days;
"
ads_ager_range_order_user="
insert overwrite table ${APP}.ads_age_range_order_user
select * from ${APP}.ads_age_range_order_user
union
select
    '$do_date' dt,
    recent_days,
    sum(if(t1.order_date_last>=date_add('$do_date',-recent_days+1),1,0)) order_user_count,
    t3.age_range
from
(
    select
        recent_days,
        user_id,
        order_date_last
    from ${APP}.dws_trade_user_order_td lateral view explode(array(1,2,3)) tmp as recent_days
    where dt='$do_date'
)t1
join
(
    select
        user_id,
        user_age,
        case when user_age>=0 and user_age<=25 then "01"
        when user_age>25 and user_age<=30 then "02"
        when user_age>30 and user_age<=35 then "03"
        when user_age>35  then "04"
        end as age_range
    from
    (
     select
       id user_id,
       round(datediff(from_unixtime(unix_timestamp(),'yyyy-MM-dd'),birthday)/365) user_age
     from ${APP}.dim_user_zip
    )t2
)t3
on
    t1.user_id=t3.user_id
group by recent_days,age_range
order by recent_days,age_range;
"
ads_interaction_paper_by_tm="
insert overwrite table ${APP}.ads_interaction_paper_by_tm
	SELECT
	'$do_date' dt,
	1 recent_days,
	paper_title,
	avg(score) score_avg,
	avg(duration_sec) duration_sec_avg,
	COUNT(DISTINCT(user_id))
	FROM
	${APP}.dws_interaction_questiontest_grades_1d
	where dt='$do_date'
	GROUP BY paper_title
	union all
	SELECT 
	'$do_date' dt,
	7 recent_days,
	paper_title,
	avg(score) score_avg,
	avg(duration_sec) duration_sec_avg,
	COUNT(DISTINCT(user_id))
	FROM
	${APP}.dws_interaction_questiontest_grades_1d
	where dt>=date_sub('$do_date',6)
	GROUP BY paper_title
	union all
	SELECT 
	'$do_date' dt,
	30 recent_days,
	paper_title,
	avg(score) score_avg,
	avg(duration_sec) duration_sec_avg,
	COUNT(DISTINCT(user_id))
	FROM
	${APP}.dws_interaction_questiontest_grades_1d
	where dt>=date_sub('$do_date',29)
	GROUP BY paper_title;
"
ads_interaction_course_by_tm="
insert overwrite table ${APP}.ads_interaction_course_by_tm
	SELECT
	'$do_date' dt,
	1 recent_days,
	course_name,
	avg(score) score_avg,
	avg(duration_sec) duration_sec_avg,
	COUNT(DISTINCT(user_id))
	FROM
	${APP}.dws_interaction_questiontest_grades_1d
	where dt='$do_date'
	GROUP BY course_name
	union all
	SELECT
	'$do_date' dt,
	7 recent_days,
	course_name,
	avg(score) score_avg,
	avg(duration_sec) duration_sec_avg,
	COUNT(DISTINCT(user_id))
	FROM
	${APP}.dws_interaction_questiontest_grades_1d
	where dt>=date_sub('$do_date',6)
	GROUP BY course_name
	union all
	SELECT
	'$do_date' dt,
	30 recent_days,
	course_name,
	avg(score) score_avg,
	avg(duration_sec) duration_sec_avg,
	COUNT(DISTINCT(user_id))
	FROM
	${APP}.dws_interaction_questiontest_grades_1d
	where dt>=date_sub('$do_date',29)
	GROUP BY course_name;
"
case $1 in
    "ads_traffic_stats_by_source_type" )
        hive -e "$ads_traffic_stats_by_source_type"
    ;;
    "ads_page_path" )
        hive -e "$ads_page_path"
    ;;
    "ads_study_play_video_by_chapter" )
        hive -e "$ads_study_play_video_by_chapter"
    ;;
    "ads_study_play_video_by_course" )
        hive -e "$ads_study_play_video_by_course"
    ;;
    "ads_audition_category_by_tm" )
        hive -e "$ads_audition_category_by_tm"
    ;;
    "ads_audition_subject_by_tm" )
        hive -e "$ads_audition_subject_by_tm"
    ;;
    "ads_audition_course_by_tm" )
        hive -e "$ads_audition_course_by_tm"
    ;;
    "ads_new_order_user_stats" )
        hive -e "$ads_new_order_user_stats"
    ;;
    "ads_order_stats_by_cate" )
        hive -e "$ads_order_stats_by_cate"
    ;;
    "ads_order_stats_by_subject" )
        hive -e "$ads_order_stats_by_subject"
    ;;
    "ads_order_stats_by_course" )
        hive -e "$ads_order_stats_by_course"
    ;;
    "ads_order_stats_by_course_all" )
        hive -e "$ads_order_stats_by_course_all"
    ;;
    "ads_order_by_province" )
        hive -e "$ads_order_by_province"
    ;;
    "ads_finishclass_chapter_finish_amount" )
        hive -e "$ads_finishclass_chapter_finish_amount"
    ;;
    "ads_user_change" )
        hive -e "$ads_user_change"
    ;;
    "ads_user_retention" )
        hive -e "$ads_user_retention"
    ;;
    "ads_user_stats" )
        hive -e "$ads_user_stats"
    ;;
    "ads_user_action" )
        hive -e "$ads_user_action"
    ;;
    "ads_new_order_user_stats" )
        hive -e "$ads_new_order_user_stats"
    ;;
    "ads_ager_range_order_user" )
        hive -e "$ads_ager_range_order_user"
    ;;
    "ads_interaction_paper_by_tm" )
        hive -e "$ads_interaction_paper_by_tm"
    ;;
    "ads_interaction_course_by_tm" )
        hive -e "$ads_interaction_course_by_tm"
    ;;
    "all" )
        hive -e "$ads_traffic_stats_by_source_type$ads_page_path$ads_study_play_video_by_chapter$ads_study_play_video_by_course$ads_audition_category_by_tm$ads_audition_subject_by_tm$ads_audition_course_by_tm$ads_new_order_user_stats$ads_order_stats_by_cate$ads_order_stats_by_subject$ads_order_stats_by_course$ads_order_stats_by_course_all$ads_order_by_province$ads_finishclass_chapter_finish_amount$ads_user_change$ads_user_retention$ads_user_stats$ads_user_action$ads_new_order_user_stats$ads_ager_range_order_user$ads_interaction_paper_by_tm$ads_interaction_course_by_tm"
    ;;
esac

